package com.feeyo.groundservice.checkin.constant

import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableLongStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import com.feeyo.groundservice.base_util.FyLog
import com.feeyo.groundservice.checkin.R
import com.feeyo.groundservice.checkin.model.CheckInPerSonBO
import com.feeyo.groundservice.checkin.model.CheckInTaskBO
import com.feeyo.groundservice.checkin.model.CheckInTaskTempBO
import com.feeyo.groundservice.checkin.model.LinkUserTaskBO


/**
 *作者：70893 on 2025-10-07
 *描述：
 */

internal var baseUrl = ""//基础url
internal var token = ""
internal var uid: String = ""
internal var statusBarColor: Int = R.color.blue_2E76EE


//全局参数
internal var checkInTaskTemp: CheckInTaskTempBO? = null

//值机列表刷新标识
internal val checkInListRefreshFlag = mutableLongStateOf(0L)

//值机人员列表刷新标识
internal val checkInUserRefreshFlag = mutableLongStateOf(0L)

//值机人员，主页提前获取到
internal var checkInUser: List<CheckInPerSonBO>? = null

//值机任务，和人员一起刷新
internal var checkInTask: List<CheckInTaskBO>? = null

//组合数据
internal val linkUserTask = mutableStateOf<List<LinkUserTaskBO>?>(null)

//数据初始化标识
internal val dataInitFinishedFlag = mutableStateOf(false)

//是否初始化完成
internal val initScrollFinishedFlag = mutableStateOf(false)

//当前字母表字母
internal val currentLetter = mutableStateOf("#")

//当前值机人员排序规则
internal val checkInSortType = mutableStateOf(CheckInSortType.DEFAULT)

//当前打开的详情页数据
internal val openDetailData = mutableStateOf<LinkUserTaskBO?>(null)

//当前过滤出的值机列表
internal val currentFilterCheckInList = mutableStateOf<List<LinkUserTaskBO>?>(null)

internal fun clearData() {
    FyLog.e("xxxx", "销毁换成数据")
    checkInTaskTemp = null
    checkInUser = null
    checkInTask = null
    linkUserTask.value = null
    dataInitFinishedFlag.value = false
    initScrollFinishedFlag.value = false
    currentLetter.value = "#"
    checkInSortType.value = CheckInSortType.DEFAULT
}

internal fun resetFlag() {
    dataInitFinishedFlag.value = false
    initScrollFinishedFlag.value = false
}